#ifndef __LIB_AGORA_ADMIN_USERMANAGERTHREADSAFE_H__
#define __LIB_AGORA_ADMIN_USERMANAGERTHREADSAFE_H__


#include <list>
#include "IUserManager.h"
#include "IMutex.h"

class	UserManagerThreadSafe : public IUserManager
{
public:
	static IUserManager*	GetUserManager(void);
	IUser*					GetUser(unsigned int id);
	IUser*					GetUser(std::string& pattern);
	unsigned int			LoadUser(void);
	unsigned int			LoadUser(unsigned int id);
	unsigned int			LoadUser(std::string& pattern);
	unsigned int			UnloadUser(void);
	unsigned int			UnloadUser(IUser* user);
	unsigned int			UnloadUser(unsigned int id);
	unsigned int			UnloadUser(std::string& pattern);
	IUser*					CreateUser(const std::string& login, const std::string& password);
	unsigned int			DeleteUser(void);
	unsigned int			UserExists(const std::string& login);

private:
	UserManagerThreadSafe();
	static IUserManager*	_instance;
	std::list<IUser*>		_user;
	IMutex*					_mtx;
};

#endif